<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<%@page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@page import="com.nobody.facepk.pojo.SessionUser"%>
<%@page import="com.nobody.facepk.model.Picture"%>
<%@page import="com.nobody.facepk.model.Friends"%>
<%@page import="com.nobody.facepk.model.Comment"%>
<%@page import="com.nobody.facepk.sns.Event"%>
<%@page import="com.nobody.facepk.sns.EventType"%>
<%@page import="com.nobody.facepk.model.User"%>
<%@page import="com.nobody.facepk.view.MatchView"%>
<%@page import="com.nobody.facepk.service.PictureService"%>
<%@page import="com.nobody.facepk.service.ServiceRegistry"%>
<%@page import="com.nobody.facepk.service.UserService"%>
<%@page import="com.nobody.facepk.service.CommentService"%>
<%@page import="java.util.Set"%>
<%@page import="java.util.List;"%>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />

<title>Insert title here</title>
<link rel="stylesheet" type="text/css" href="sheet1.css" media="all"></link>
  <%
  User user= (User)request.getAttribute("user");
  //List  pictures = (List)request.getAttribute("pictures");
  //int picturesSize = pictures.size();
  List myFriends = (List)request.getAttribute("friends");
  List  scoringPictures = (List)request.getAttribute("scoringPictures");
  int scoringPicturesSize = scoringPictures.size();
  List endScoringPictures = (List)request.getAttribute("endScoringPictures");
  int endScoringPicturesSize = endScoringPictures.size();
  
  List events = (List)request.getAttribute("events");
 // int eventSize = events.size();
  //List freePictures  = (List)request.getAttribute("freePictures");
  
  List list_mv   = (List)request.getAttribute("list_mv");
  List list_end_mv = (List)request.getAttribute("list_end_mv");
  PictureService pictureService = ServiceRegistry.getPictureService();
  UserService    userService    = ServiceRegistry.getUserService();
  CommentService commentService    = ServiceRegistry.getCommentService();
  %>
</head>
<body>
<div id="content">
<div id="head">
<div id="temp">
<H1>sFace PK</H1>
</div>

<div id="navbar">
<table>
	<tr>
		<td>首页</td>
		<td>个人主页</td>
		<td>相册</td>
		<td>账户</td>
	</tr>
</table>
</div>
</div>
<div id="leftFrame">
 <table>
 <p>
 <%=user.getName() %>的朋友
 </p>
 <p>
<%=user.getName() %>的好友:
</p>
    	<%
    		for(int i = 0 ; i < myFriends.size() ; i ++){
    		User friend = (User)myFriends.get(i);
    		%>
    		
    		<p>
    		<a href="friendInfo.do?friendId=<%=friend.getId()%>&isMe=false"><%=friend.getName()%></a>
    		</p>
    		
    		<%
    		}
	    	 %>
	    	
	    <p  >
    	<a href="addFriend.jsp">添加好友</a>
    	</p>
    </table>


</div>
<div id="rightFrame">

  <table>
    	欢迎来到facepk<br/>
为了迅速开始有趣的历程，我们为你准备了几个新手任务<br/>
<a href="#">1 注册帐号</a>
<a href="#">2 给别人的相貌评分</a>
<a href="#">3 参与相貌的pk</a>
   	</table>
-----------------------------------------------------------------------------
  <table>
    	请你评分:<br/>
    	<%
    	if(scoringPicturesSize == 0 ){%>
    	暂无图片。
    	<%}else{
    	if(scoringPicturesSize>4) scoringPicturesSize = 4; //首页最多显示6张
    	for(int i = 0 ; i < scoringPicturesSize ; i ++){
    	Picture  pic  = (Picture)scoringPictures.get(i);
    	String picPath = pic.getPath();
    	String picName = pic.getName();
    	String realPath = "pictures/"+pic.getUserId()+"/"+picPath;
    	%>
    	<img src="<%=realPath %>" height="80" width="80"/>
    	<a href="scorePicture.do?id=<%=pic.getId()%>">评分</a>
    	<a href="comment.do?picId=<%=pic.getId()%>">留言</a>
    	当前评论次数:<%=pic.getScoreCount() %>
    	当前得分:<%=pic.getScore() %><br/>
    	
    	<%
            }
    	 }
    	%>
</table>

-----------------------------------------------------------------------------
<table>
    	请你PK:<br/>
    	<%
    	if(list_mv.size() == 0 ){%>
    	暂无图片。
    	<%}else{
    	for(int i = 0 ; i < list_mv.size() ; i ++){
    	MatchView  view  = (MatchView)list_mv.get(i);
    	String hostPath = view.getHostPath();
    	String guestPath = view.getGuestPath();
    	long hostUserId = view.getHostUserid();
    	long guestUserId = view.getGuestUserid();
    	long hostId = view.getHostId();
    	long guestId = view.getGuestId();
    	long matchId = view.getMatchId();
    	
    	String hostRealPath = "pictures/"+hostUserId+"/"+hostPath;
    	String guestRealPath =  "pictures/"+guestUserId+"/"+guestPath;
    	%>
    	<a href="pollInfo.do?matchid=<%=matchId%>"><img src="<%=hostRealPath %>" height="80" width="80"/></a>
    	 pk 
    	<a href="pollInfo.do?matchid=<%=matchId%>"> <img src="<%=guestRealPath %>" height="80" width="80"/></a>
    	<br/>
    	
    	<%
    	
            }
    	 }
    	%>
</table>
-----------------------------------------------------------------------------
<table>
    	最近评分完成的照片:<br/>
    	<%
    	if(endScoringPicturesSize == 0 ){%>
    	暂无图片。
    	<%}else{
    	if(endScoringPicturesSize>4) endScoringPicturesSize = 4; //首页最多显示6张
    	for(int i = 0 ; i < endScoringPicturesSize ; i ++){
    	Picture  pic  = (Picture)endScoringPictures.get(i);
    	String picPath = pic.getPath();
    	String picName = pic.getName();
    	String realPath = "pictures/"+pic.getUserId()+"/"+picPath;
    	%>
    	<img src="<%=realPath %>" height="80" width="80"/>
    	<a href="scorePicture.do?id=<%=pic.getId()%>">评分</a>
    	<a href="comment.do?picId=<%=pic.getId()%>">留言</a>
    	当前评论次数:<%=pic.getScoreCount() %>
    	当前得分:<%=pic.getScore() %><br/>
    	<%
            }
    	 }
    	%>
</table>

</div>



</div>
</body>
</html>